#include <iostream>
#include <sstream>
#include <opencv2/opencv.hpp>
#include <time.h>

using namespace cv;
using namespace std;

/**用于从视频中挑选图片，默认播放速度30FPS，按s进行图片保存*/

int main(int, char **)
{
    Mat srcImg;
    VideoCapture cap("/home/llrt/桌面/opecv_demo/build/cam1_144fps.avi");
    string imgSuff = ".jpg";
    String imgPath = "/home/llrt/文档/car_data/";
    while (true)
    {
        stringstream ss;
        string imgName;
        cap >> srcImg;
        time_t timep;
        time(&timep);
        ss << timep;
        ss >> imgName;
        imshow("srcImg", srcImg);
        if (waitKey(30) == 's')
        {
            imwrite(imgPath + imgName + imgSuff, srcImg);
        }
    }
}
